package org.example.homework.mapper;

import org.apache.ibatis.annotations.*;
import org.example.homework.entity.Product;
import java.util.List;

@Mapper
public interface ProductMapper {
    @Results(value = {
            @Result(property = "imageUrl", column = "image_url"),
    })
    @Select("SELECT * FROM product WHERE id = #{id}")
    Product findById(Integer id);

    @Select("SELECT * FROM product")
    List<Product> findAll();

    @Select("SELECT * FROM product WHERE category = #{category}")
    List<Product> findByCategory(String category);
} 